import React,{Component} from 'react';
import { PrimaryButton } from 'office-ui-fabric-react';

class ClassCounter extends Component{
    
    // ===========生命周期 start========================
    
    constructor(props){
        super(props)
        this.state = { count:0 }
        // debugger
    }

    componentWillMount(){
        console.log('class component 》》》 componentWillMount');
    }

    componentDidMount(){
        console.log('class component 》》》 componentDidMount');
    }

    componentDidUpdate(){
        console.log('class component 》》》 componentDidUpdate');
    }

    componentWillUnmount(){
        console.log('class component 》》》 componentWillUnmount');
    }

    render(){
        return (
            <div>
                <span>class component >>> count = {this.state.count}</span>
                <PrimaryButton text='click me' onClick={this.handleClick}/>
            </div>
        );
    }

    // ===========生命周期 end========================



    handleClick = () => {
        this.setState({
            count:this.state.count+1
        })
    }



}

export default ClassCounter;